import request from '@/utils/request.js'
import store from '../store'
export const AllChannelListAPI = () => {
  return request({
    url: '/v1_0/channels'
  })
}
export const userChannelAPI = () => request({
  url: '/v1_0/user/channels',
  headers: {
    Authorization: 'Bearer ' + store.state.token
  }
})
export const loginAPI = ({ mobile, code }) => {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}
// 文章 - 获取列表
export const articlesListAPI = ({ channelId, timestamp }) => {
  return request({
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp: timestamp || (new Date()).getTime()
    }
  })
}
// 对文章不喜欢
export const articleDislikeAPI = ({ target }) => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'POST',
    data: {
      target: target
    },
    headers: {
      Authorization: 'Bearer ' + store.state.token
    }
  })
}
// 文章 - 举报
export const articleReportsAPI = ({ target, type, remark }) => {
  return request({
    url: '/v1_0/article/reports',
    method: 'POST',
    data: {
      target: target,
      type: type,
      remark: remark
    },
    headers: {
      Authorization: 'Bearer ' + store.state.token
    }
  })
}
